home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / editors / emcs1857 / 1857sr~1.zoo / lisp / term / fa4440b.el < prev    next >
Encoding:
Text File  |  1992-01-24  |  4.8 KB  |  148 lines

  1. ;;; Set up Facit 4440 (Twist) terminal.
  2.  
  3. ;; Map Twist function key escape sequences
  4. ;; into the standard slots in function-keymap.
  5.  
  6. (require 'keypad)
  7.  
  8. (keypad-default "p" 'redraw-screen-72-lines)
  9. (keypad-default "q" 'redraw-screen-24-lines)
  10.  
  11. (defvar CSI-map nil
  12.   "The CSI-map maps the CSI function keys on the Twist keyboard.
  13. The CSI keys are the arrow keys.")
  14.  
  15. (if (not CSI-map)
  16.     (progn
  17.      (setq CSI-map (lookup-key global-map "\e["))
  18.      (if (not (keymapp CSI-map))
  19.      (setq CSI-map (make-sparse-keymap)))  ;; <ESC>[ commands
  20.      (setup-terminal-keymap CSI-map '(
  21.         ("A"   . ?u) ; up arrow
  22.     ("B"   . ?d) ; down-arrow
  23.     ("C"   . ?r) ; right-arrow
  24.     ("D"   . ?l) ; left-arrow
  25.     ("H"   . ?h) ; home
  26.     ("J"   . ?C) ; shift-erase = clear screen
  27.     ("K"   . ?c) ; erase
  28.     ("L"   . ?A) ; insert line
  29.     ("M"   . ?L) ; delete line
  30.     ("P"   . ?D) ; delete character
  31.     ("U"   . ?N) ; shift-down-arrow = next page
  32.     ("V"   . ?P) ; shift-up-arrow = previous page
  33.     ("X"   . ?H) ; shift-home = home-down
  34.     ("Z"   . ?b) ; tabulation backward
  35.     ("4h"  . ?I) ; insert character
  36.     ("?Ln" . ?q) ; landscape mode
  37.     ("?Pn" . ?p) ; portrait mode
  38. ))))
  39.  
  40. (defun enable-arrow-keys ()
  41.   "Enable the use of the Twist arrow keys for cursor motion.
  42. Because of the nature of the Twist, this unavoidably breaks
  43. the standard Emacs command ESC [; therefore, it is not done by default,
  44. but only if you give this command."
  45.   (interactive)
  46.   (global-set-key "\e[" CSI-map)
  47.   (send-string-to-terminal "\e[?1n") ; Landscape or portrait?
  48. )
  49.  
  50. (defvar SS3a-map nil
  51.   "SS3a-map maps the SS3 function keys on the Twist keyboard.
  52. The SS3 keys are the numeric keypad keys in keypad application mode
  53. \(DECKPAM).  SS3 is DEC's name for the sequence <ESC>O which is
  54. the common prefix of what these keys transmit.")
  55.  
  56. (if (not SS3a-map)
  57.     (progn
  58.      (setq SS3a-map (lookup-key global-map "\eO"))
  59.      (if (not (keymapp SS3a-map))
  60.      (setq SS3a-map (make-keymap)))  ;; <ESC>O commands
  61.      (setup-terminal-keymap SS3a-map
  62.         '(("A" . ?u)       ; up arrow
  63.           ("B" . ?d)       ; down-arrow
  64.           ("C" . ?r)       ; right-arrow
  65.           ("D" . ?l)       ; left-arrow
  66.           ("M" . ?e)       ; Enter
  67.           ("P" . ?\C-a)       ; PF1
  68.           ("Q" . ?\C-b)       ; PF2
  69.           ("R" . ?\C-c)       ; PF3
  70.           ("S" . ?\C-d)       ; PF4
  71.           ("l" . ?,)       ; ,
  72.           ("m" . ?-)       ; -
  73.           ("n" . ?.)       ; .
  74.           ("p" . ?0)       ; 0
  75.           ("q" . ?1)       ; 1
  76.           ("r" . ?2)       ; 2
  77.           ("s" . ?3)       ; 3
  78.           ("t" . ?4)       ; 4
  79.           ("u" . ?5)       ; 5
  80.           ("v" . ?6)       ; 6
  81.           ("w" . ?7)       ; 7
  82.           ("x" . ?8)       ; 8
  83.           ("y" . ?9)))))       ; 9
  84.  
  85. (defun keypad-application-mode ()
  86.   "Switch on keypad application mode."
  87.   (interactive)
  88.   (send-string-to-terminal "\e=")
  89.   (global-set-key "\eO" SS3a-map))
  90.  
  91. (defvar SS3n-map nil
  92.   "SS3n-map maps the SS3 function keys on the Twist keyboard.
  93. The SS3 keys are the numeric keypad keys in keypad numeric mode
  94. \(DECKPAM).  SS3 is DEC's name for the sequence <ESC>O which is
  95. the common prefix of what these keys transmit.")
  96.  
  97. (if (not SS3n-map)
  98.     (progn
  99.      (setq SS3n-map (lookup-key global-map "\eO"))
  100.      (if (not (keymapp SS3n-map))
  101.      (setq SS3n-map (make-sparse-keymap)))  ;; <ESC>O commands
  102.      (setup-terminal-keymap SS3n-map '(
  103.           ("P" . ?\C-a)       ; PF1
  104.           ("Q" . ?\C-b)       ; PF2
  105.           ("R" . ?\C-c)       ; PF3
  106.           ("S" . ?\C-d)       ; PF4
  107.      ))
  108.     (global-set-key "\eO" SS3n-map)
  109. ))
  110.  
  111. (if (fboundp 'get-glyf)
  112.    (progn
  113.       (require 'iso8859-1-swedish)
  114.       (require 'char-table-vt100)
  115.       (send-string-to-terminal "\e)B\e)1") ; Select Swedish letters as G1 set.
  116.       (standard-char-underline 170 ?a) ; ordinal indicator, feminine
  117.       (standard-char-graphic   176 125); degree sign
  118.       (standard-char-graphic   177 ?~) ; plus or minus sign
  119.       (standard-char-graphic   183 ?g) ; middle dot
  120.       (standard-char-underline 186 ?o) ; ordinal indicator, masculine
  121.       (standard-frameg-graphic ?x)     ; Vertical bar.
  122.       (standard-truncg-graphic ?t)     ; Left T.
  123.       (standard-wrapg-graphic  ?k)     ; Upper right corner.
  124.    )
  125. )
  126.  
  127. (defun redraw-screen-24-lines ()
  128.    "This function is intended for use with Facit Twist terminals.
  129. It should be bound to \"C-[[?Ln\", which is what the terminal transmits
  130. when it is twisted into landscape mode.  The terminal must also have
  131. the Display Report switch (custom setup 4, group 1, switch 3) set to
  132. Auto."
  133.    (interactive)
  134.    (set-screen-height 24))
  135.    
  136. (defun redraw-screen-72-lines ()
  137.    "This function is intended for use with Facit Twist terminals.
  138. It should be bound to \"C-[[?Pn\", which is what the terminal transmits
  139. when it is twisted into portrait mode.  The terminal must also have
  140. the Display Report switch (custom setup 4, group 1, switch 3) set to
  141. Auto."
  142.    (interactive)
  143.    (send-string-to-terminal "\e[r")
  144.    (set-screen-height 72))
  145.  
  146. (setq start-emphasis "\e[4m") ; Underline on.
  147. (setq stop-emphasis  "\e[m")  ; Underline off.
  148.